# time
import time

print(time.asctime())  # Wed Oct 25 20:18:48 2023

# 睡眠
time.sleep(1)

# 时间格式化
#     %Y  Year with century as a decimal number.
#     %m  Month as a decimal number [01,12].
#     %d  Day of the month as a decimal number [01,31].
#     %H  Hour (24-hour clock) as a decimal number [00,23].
#     %M  Minute as a decimal number [00,59].
#     %S  Second as a decimal number [00,61].
#     %z  Time zone offset from UTC.
#     %a  Locale's abbreviated weekday name.
#     %A  Locale's full weekday name.
#     %b  Locale's abbreviated month name.
#     %B  Locale's full month name.
#     %c  Locale's appropriate date and time representation.
#     %I  Hour (12-hour clock) as a decimal number [01,12].
#     %p  Locale's equivalent of either AM or PM.
t = time.strftime('%Y-%m-%d %H:%M:%S')
print(t, type(t))  # 2023-10-25 20:20:26 <class 'str'>
#

# 1970秒数
t = time.time()
print(t, type(t))  # 1698237963.8679738 <class 'float'>

# struct_time 时间元组 （年，月...)
t = time.localtime()
print(t, type(
    t))  # time.struct_time(tm_year=2023, tm_mon=10, tm_mday=25, tm_hour=20, tm_min=46, tm_sec=42, tm_wday=2, tm_yday=298, tm_isdst=0) <class 'time.struct_time'>
